Skip to content

ci: daily Hacktoberfest 2026 prep tracker refresh (cron 11:50 UTC) - #15225

Merged
cclauss merged 4 commits into
TheAlgorithms:masterfrom
priya-sundaram-dev:hacktober-prep-cron
Sep 8, 2026
Merged

ci: daily Hacktoberfest 2026 prep tracker refresh (cron 11:50 UTC)#15225
cclauss merged 4 commits into
TheAlgorithms:masterfrom
priya-sundaram-dev:hacktober-prep-cron

Conversation

@priya-sundaram-dev

Copy link
Copy Markdown
Contributor

As requested on #15081.

Describe your change:

Adds a daily GitHub Actions cron job that keeps docs/hacktober_2026_prep.md current on its own until Hacktoberfest begins.

.github/workflows/hacktoberfest_prep.ymlschedule: "50 11 * * *" (11:50 UTC daily) plus workflow_dispatch for manual runs. Guarded to github.repository == 'TheAlgorithms/Python' so forks do not run it, and it commits any tracker changes back with the Actions GITHUB_TOKEN.

scripts/hacktoberfest_prep_update.py (standard library only) does three things each run:

  1. Updates the checkboxes — for every tracked row that is still an unchecked [ ], it checks the live PR state and ticks the box ([ ] -> [x]) with merged / closed when the PR has resolved.
  2. Adds statistics — rewrites a machine-generated ## Automated statistics section at the end of the file with the current number of open issues and open pull requests.
  3. Recommends the top three directories to work on — the three algorithm directories with the most open pull requests labelled awaiting reviews.

It fails on purpose after 2026-10-01 (the script returns a non-zero exit code once Hacktoberfest 2026 has begun), so the prep window closing is loud rather than silent and the job can be retired. The workflow still commits any final changes before propagating that exit code.

The stats section and any newly-resolved checkboxes are populated by the first scheduled (or manually dispatched) run, so this PR keeps the diff to just the workflow + script. I ran the script locally against the live repo to verify the PR-state lookups, the open-issue/PR counts, and the awaiting reviews directory ranking all work; ruff check and ruff format are clean.

  • Add an algorithm or a new feature (CI tooling).
  • Documentation change (keeps the prep tracker current).

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • All new Python files are placed inside an existing directory (scripts/).
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • The code is ruff-clean and formatted.

Adds .github/workflows/hacktoberfest_prep.yml (schedule: 50 11 * * *) and
scripts/hacktoberfest_prep_update.py. Each run:

- ticks tracked PR rows in docs/hacktober_2026_prep.md that are now
  merged/closed (`[ ]` -> `[x]`),
- rewrites an 'Automated statistics' section with the current open issue and
  open PR counts plus the top three directories with the most open
  'awaiting reviews' PRs,
- exits non-zero once Hacktoberfest 2026 has begun (>= 2026-10-01), so the
  prep window closing is loud and the job gets retired.

Standard library only; uses the Actions GITHUB_TOKEN. Refs TheAlgorithms#15081.
@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Sep 8, 2026
@algorithms-keeper algorithms-keeper Bot added the tests are failing Do not merge until tests pass label Sep 8, 2026
@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label Sep 8, 2026
Comment thread scripts/hacktoberfest_prep_update.py Outdated
Actions runner, so there is nothing to install.
"""

from __future__ import annotations

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add to github/skills/*/SKILL.md: The line from __future__ import annotations is not needed on a repo that only supports Python >= 3.14t.

@algorithms-keeper algorithms-keeper Bot added awaiting changes A maintainer has requested changes to this PR and removed awaiting reviews This PR is ready to be reviewed labels Sep 8, 2026
Comment thread scripts/hacktoberfest_prep_update.py Outdated
import time
import urllib.error
import urllib.parse
import urllib.request

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we / should we use httpx2 instead

Address review feedback on the Hacktoberfest prep cron:
- Switch the tracker script from urllib to httpx2, the repo's standard
  HTTP client, and add an install step to the workflow.
- Drop 'from __future__ import annotations' (unnecessary on Python >= 3.14t).
@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed and removed awaiting changes A maintainer has requested changes to this PR labels Sep 8, 2026
@priya-sundaram-dev

Copy link
Copy Markdown
Contributor Author

Thanks for the review — both addressed in 9a540d3:

  • httpx2: switched _request from urllib to httpx2 (repo standard) and added a pip install httpx2 step to the workflow. Rate-limit/retry handling is preserved via resp.status_code + raise_for_status(). Smoke-tested against the live API (open-PR count and pr_state() both return correctly).
  • from __future__ import annotations: removed from the script — you're right it's unnecessary on >= 3.14t. The guidance is already captured in both .github/skills/*/SKILL.md ("not needed because this repo only uses the latest version of CPython"), so no doc change needed there; happy to reword it to name 3.14t explicitly if you'd prefer.

Ruff 0.16.5 clean (check + format).

@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 8, 2026
@cclauss
cclauss merged commit 1eeed73 into TheAlgorithms:master Sep 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants